import request from "@/utils/request";

const path = '/banners'

// 新增轮播图
export const addBanner = (data) => {
    return request({
        url: path,
        method: 'post',
        data
    })
}

// 分页查询轮播图接口
export const getBanners = (params) => {
    return request({
        url: path,
        method: 'get',
        params
    })
}

// 根据id查询轮播图接口
export const getBannersById = (id) => {
    return request({
        url: path + `/${id}`,
        method: 'get'
    })
}

// 修改轮播图接口
export const updateBanner = (data) => {
    return request({
        url: path,
        method: 'put',
        data
    })
}

// 修改轮播图状态接口
export const updateBannersStatus = (data) =>
    request({
        'url': path + `/status/${data.status}`,
        'method': 'put',
        params: { id: data.id }
    })

// 删除轮播图接口
export const deleteBannersById = (id) => {
    return request({
        url: path + `/${id}`,
        method: 'delete'
    })
}
